package c.e.b.h.e.s;

import c.e.b.h.e.k.x0;
import c.e.b.h.e.s.i.c;
import c.e.b.h.e.s.i.d;
import c.e.b.h.e.s.i.f;
import com.huawei.hms.support.api.entity.pay.HwPayConstant;
import java.util.Objects;
import org.json.JSONException;
import org.json.JSONObject;

/* compiled from: DefaultSettingsJsonTransform */
public class b implements g {
    public static long b(x0 x0Var, long j, JSONObject jSONObject) {
        String str = "expires_at";
        if (jSONObject.has(str)) {
            return jSONObject.optLong(str);
        }
        Objects.requireNonNull(x0Var);
        return (j * 1000) + System.currentTimeMillis();
    }

    public f a(x0 x0Var, JSONObject jSONObject) throws JSONException {
        JSONObject jSONObject2 = jSONObject;
        int optInt = jSONObject2.optInt("settings_version", 0);
        int optInt2 = jSONObject2.optInt("cache_duration", 3600);
        JSONObject jSONObject3 = jSONObject2.getJSONObject("app");
        return new f(b(x0Var, (long) optInt2, jSONObject2), new c.e.b.h.e.s.i.b(jSONObject3.getString("status"), jSONObject3.getString(HwPayConstant.KEY_URL), jSONObject3.getString("reports_url"), jSONObject3.getString("ndk_reports_url"), jSONObject3.optBoolean("update_required", false)), new d(jSONObject2.getJSONObject("session").optInt("max_custom_exception_events", 8), 4), new c(jSONObject2.getJSONObject("features").optBoolean("collect_reports", true)), optInt, optInt2);
    }
}
